#ifndef BALANCER__STATISTIC_H_
#define BALANCER__STATISTIC_H_

#include <unordered_map>
#include <string>
#include <mutex>

using std::unordered_map;
using std::string;
using std::mutex;

class Statistic {
 public:
  static Statistic *getInstance();
  void CollectUserData(const std::string &userName, uint64_t bytes);
  void SyncStatisticData(const std::string &workDir);

 private:
  Statistic();
  ~Statistic();
  void operator=(const Statistic &) = delete;

 private:
  unordered_map<string, uint64_t> userMap_;
  static Statistic * instance_;
  static mutex mutex_;
  mutex local_mutex_;
};

#endif //BALANCER__STATISTIC_H_
